/**
 * Mock配置文件
 */

export const mockConfig = {
  // 是否启用mock
  enabled: true,
  
  // 延迟时间范围（毫秒）
  timeout: {
    min: 200,
    max: 600
  },
  
  // 是否打印mock请求日志
  logEnabled: true,
  
  // 模拟网络错误概率（0-1）
  errorRate: 0.05,
  
  // 模拟网络延迟概率（0-1）
  delayRate: 0.8,
  
  // 响应状态码配置
  statusCodes: {
    success: 200,
    badRequest: 400,
    unauthorized: 401,
    forbidden: 403,
    notFound: 404,
    serverError: 500
  },
  
  // 分页配置
  pagination: {
    defaultPageSize: 10,
    maxPageSize: 100
  },
  
  // 数据生成配置
  dataGeneration: {
    // 用户数据
    users: {
      defaultCount: 100,
      maxCount: 1000
    },
    
    // 订单数据
    orders: {
      defaultCount: 50,
      maxCount: 500
    },
    
    // 产品数据
    products: {
      defaultCount: 200,
      maxCount: 2000
    }
  },
  
  // 权限配置
  permissions: {
    // 默认角色权限
    roles: {
      admin: ['*'], // 管理员拥有所有权限
      manager: [
        'dashboard:view',
        'system:user:list',
        'system:user:view',
        'operations:*',
        'inventory:*',
        'purchase:*',
        'sales:*',
        'finance:*',
        'logistics:*',
        'reports:*'
      ],
      employee: [
        'dashboard:view',
        'operations:customer:list',
        'operations:supplier:list',
        'inventory:query:list',
        'purchase:order:list',
        'sales:order:list'
      ],
      supplier: [
        'dashboard:view',
        'purchase:order:list',
        'finance:payable:list'
      ],
      customer: [
        'dashboard:view',
        'sales:order:list',
        'finance:receivable:list'
      ]
    }
  }
}

// 开发环境配置
if (import.meta.env.DEV) {
  mockConfig.enabled = true
  mockConfig.logEnabled = true
}

// 生产环境配置
if (import.meta.env.PROD) {
  mockConfig.enabled = false
  mockConfig.logEnabled = false
}

export default mockConfig 